﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using demo.BLL;
using demo.Entity;
using iAgileFramework.DataTransCarrier;

namespace WebApplication1.Areas.Manage.Controllers
{
    public class RegisterController : ControllerBase
    {
        public UserBLL bll = new UserBLL();
        // GET: Manage/Register
        [AllowAnonymous]
        public ActionResult Index()
        {
            return View();
        }
        /// <summary>
        /// 是否已存在账号
        /// </summary>
        /// <param name="account">账号</param>
        /// <returns></returns>
        [HttpPost]
        [AllowAnonymous]
        public ActionResult IsExists(string account)
        {
            return this.Json(bll.IsExists(account));
        }

        /// <summary>
        /// 注册
        /// </summary>
        /// <param name="model">实体</param>
        /// <returns></returns>
        [AllowAnonymous]
        [HttpPost]
        public ActionResult DoRegister(Users model)
        {
            var rv = new ReturnValue();
            rv = base.ModelValidate();
            if (!rv.State)
            {
                return this.Json(rv);
            }
            return this.Json(bll.DoRegister(model));
        }
        
    }
}